package com.rayc.mall.logistic.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rayc.mall.common.result.PageDTO;
import com.rayc.mall.common.result.Result;
import com.rayc.mall.logistic.domain.po.OrderLogistics;
import com.rayc.mall.logistic.domain.query.LogisticsPageQuery;
import com.rayc.mall.logistic.service.IOrderLogisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Ray-C
 * @CreateTime: 2025-03-25
 * @Description: 管理员物流管理相关接口
 * @Version: 1.0
 */
@Slf4j
@Api(tags = "管理员物流管理相关接口")
@RestController
@RequestMapping("/admin/logistics")
@RequiredArgsConstructor
public class AdminLogisticsController {
    private final IOrderLogisticsService orderLogisticsService;

    @ApiOperation("分页查询物流信息")
    @GetMapping("/page")
    public Result<PageDTO<OrderLogistics>> queryLogisticsByPage(LogisticsPageQuery query) {
        log.info("分页查询物流信息 {}", query);
        Page<OrderLogistics> result = orderLogisticsService.search(query);
        PageDTO<OrderLogistics> pageResult = PageDTO.of(result, OrderLogistics.class);
        log.info("分页查询物流信息结果 {}", pageResult);
        return Result.success(pageResult);
    }
}
